<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<script>

  function page(n,s){
    $("#pageNo").val(n);
    $("#pageSize").val(s);
    $("#searchForm").submit();
    return false;
  }

  function loadFormData(patId,name,sex,age,chargeType,identity,idNo,unitInContract){
    assignment(patId,name,sex,age,chargeType,identity,idNo,unitInContract);
  }

  //回写基本信息
  function assignment(patId,name,sex,age,chargeType,identity,idNo,unitInContract){
    $("#patientId").val(patId);
    $("#name").val(name);
    if(sex!=null && sex!=""){
      $("#sexID option[value="+sex+"]").attr("selected","selected");
      $("#sexID").change();
    }
    $("#age").val(age);
    $("#visitIndicator option[value='2']").attr("selected","selected");
    $("#visitIndicator").change();
    if(chargeType!=null && chargeType!=""){
      $("#chargeType option[value="+chargeType+"]").attr("selected","selected");
      $("#chargeType").change();
    }
    if(identity!=null && identity!=""){
      $("#identity option[value="+identity+"]").attr("selected","selected");
      $("#identity").change();
    }
    $("#idNo").val(idNo);
    $("#unitInContract").val(unitInContract);
//    layer.close(patientInfo);
  }
</script>
<div class="panel-body">
          <div class="datatable-top">
            <div class="pull-left">
              <form:form id="searchForm"  modelAttribute="patMasterIndex" onsubmit="return loadDivForm('phyUserRight','searchForm','${ctx}/physical/addphyUser');" method="post" class="form-inline">
                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                &nbsp;&nbsp;<label>姓名 ：</label><form:input path="name" maxlength="50" class="form-control" ></form:input>
                &nbsp;&nbsp;<label>出生日期：</label><form:input path="birthdayDate"  class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"></form:input>
                &nbsp;&nbsp;<label>电话:</label><form:input path="phone" class="form-control"></form:input>
                &nbsp;&nbsp;<label>身份证：</label><form:input path="idNo" class="form-control"></form:input>
                <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
              </form:form>
            </div>
          </div>
          <table id="contentTable" class="table table-bordered mg-t datatable" style="width: 100%">
            <thead>
            <tr>
              <th>姓名</th>
              <th>性别</th>
              <th>年龄</th>
              <th>电话</th>
              <th>身份证号</th>
              <th>合同单位</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="pat">
            <tr onclick="loadFormData('${pat.id}','${pat.name}','${pat.sex}','${pat.age}','${pat.chargeType}','${pat.identity}','${pat.idNo}','${pat.unitInContract}')">
              <td> ${pat.name}</td>
              <td> ${fns:getDictLabel(pat.sex, 'SEX_DICT', '')}</td>
              <td> ${pat.age}</td>
              <td> ${pat.phone}</td>
              <td> ${pat.idNo}</td>
              <td> ${pat.unitInContract}</td>
            </tr>
            </c:forEach>
          </table>
          <div class="pagination">${page}</div>
        </div>